In this section, all the required libraries are read, and the data is uploaded in r. https://bookdown.org/yihui/rmarkdown/output-formats.html
Now the data is loaded
setwd("C:/Users/user/Desktop/Biologie/Master/Thesis/Thesis/data/raw")
maaginhoud <- as.tibble(read.csv2("C:/Users/user/Desktop/Biologie/Master/Thesis/Thesis/data/raw/Maaginhoud.csv", sep = ";", dec = ",")) # leest de ruwe dataset (count van maaginhoud)
## Warning: `as.tibble()` is deprecated, use `as_tibble()` (but mind the new semantics).
## This warning is displayed once per session.
head(maaginhoud)
## # A tibble: 6 x 77
## nr Potje.staart.ve~ Potje.Maaginhoud datum Locatie Gewicht.Glasaal
## <int> <fct> <int> <fct> <fct> <dbl>
## 1 60 A 1 24/0~ PG-KR 0.211
## 2 278 A 1 12/0~ MI-RO-~ 0.294
## 3 215 A 1 5/05~ MI-RO-~ 0.211
## 4 183 A 1 28/0~ PG-LO-~ 0.147
## 5 219 A 1 12/0~ PG-RO-~ 0.227
## 6 242 A 1 15/0~ PG-LO-~ 0.2
## # ... with 71 more variables: Gewicht.maag.darmstelsel <dbl>,
## # Opmerkingen <fct>, Microplastics.Contaminatie.vezels..katoen.. <int>,
## # X <lgl>, Cladocera.sp. <int>, X.1 <lgl>, Annelida <int>, X.2 <lgl>,
## # Polychaete <int>, X.3 <lgl>, Isopoda <int>, X.4 <lgl>,
## # Diptera.sp. <int>, X.5 <lgl>, Chironomide.thummi.plummosus <int>,
## # X.6 <lgl>, Crustaceae.sp. <int>, X.7 <lgl>, Cycloida.sp. <int>,
## # X.8 <lgl>, Invertebrata..larve..sp. <int>, X.9 <lgl>,
## # Daphnidae.sp...ingekapseld. <int>, X.10 <lgl>,
## # Cladocera.sp...Chydorus.sphaericus. <int>, X.11 <lgl>,
## # Amphipoda.sp. <int>, X.12 <lgl>,
## # Calanoide.Copepode..Pseudocalanus.elongatus. <int>, X.13 <lgl>,
## # Gammarus <int>, X.14 <lgl>, Calanoide.copepode <int>, X.15 <lgl>,
## # unidentifiable.eggs <int>, X.16 <lgl>, Copepoda.sp. <int>, X.17 <lgl>,
## # Copepoda..Oithona.similis..male. <int>, X.18 <lgl>,
## # Harpacticoid.Copepod <int>, X.19 <lgl>, Pleuroxus.sp. <int>,
## # X.20 <lgl>, Chydorus.sp. <int>, X.21 <lgl>,
## # Detritus.plantenafval <int>, X.22 <lgl>, Plantae.sp. <int>,
## # X.23 <lgl>, Pennate.diatomee <int>, X.24 <lgl>,
## # Detritus.met.schimmelfilamenten <int>, X.25 <lgl>,
## # Invertebrate.sp. <int>, X.26 <lgl>, Hexapode.sp.... <int>, X.27 <lgl>,
## # keverlarve <int>, X.28 <lgl>, Chironomide..Non.thummi.plumosus. <int>,
## # X.29 <lgl>, Nereis.sp. <int>, X.30 <lgl>,
## # Amphipode..Atylus.sp.. <int>, X.31 <lgl>, Chironomide.sp. <int>,
## # X.32 <lgl>, Simulium.sp. <int>, X.33 <lgl>, X.34 <lgl>
maaginhoud2 <- as.tibble(read.csv2("C:/Users/user/Desktop/Biologie/Master/Thesis/Thesis/data/raw/Maaginhoud2.csv", sep = ";", dec = ","))
head(maaginhoud2)
## # A tibble: 6 x 24
## nr datum Locatie Locatie_A Locatie_Oever Methode Microplastics.C~
## <int> <fct> <fct> <fct> <fct> <fct> <int>
## 1 60 24/0~ PG-KR Pompgema~ midden Kruisn~ 1
## 2 278 12/0~ MI-RO-~ Midden VA RO Substr~ 0
## 3 215 5/05~ MI-RO-~ Midden VA RO Substr~ 0
## 4 183 28/0~ PG-LO-~ Pompgema~ LO Substr~ 1
## 5 219 12/0~ PG-RO-~ Pompgema~ RO Paling~ 0
## 6 242 15/0~ PG-LO-~ Pompgema~ LO Paling~ 0
## # ... with 17 more variables: Cladocera.sp. <int>, Annelida <int>,
## # Polychaete <int>, Isopoda <int>, Diptera.sp. <int>,
## # Chironomida.sp. <int>, Crustaceae.sp. <int>, Cycloida.sp. <int>,
## # Unidentified.sp. <int>, Amphipoda.sp. <int>, Calanoida.sp. <int>,
## # Copepoda.sp. <int>, Harpacticoid.Copepod <int>, Hexapode.sp.... <int>,
## # keverlarve <int>, Pennate.diatomee <int>, Plantae.sp. <int>
data_inbo <- as.tibble(read.csv2("C:/Users/user/Desktop/Biologie/Master/Thesis/Thesis/data/raw/Glass eel stock deepfreeze 2017.csv", sep = ";", dec = ",")) # leest de data van het inbo genoteerd bij de glasaalstaalname
head(data_inbo)
## # A tibble: 6 x 22
## nr Date Location Catchment.method length..mm. weight.mg.
## <int> <fct> <fct> <fct> <int> <int>
## 1 1 10/0~ VA_PG_R~ Palinggoot 77 347
## 2 2 10/0~ VA_PG_R~ Palinggoot 74 315
## 3 3 10/0~ VA_PG_R~ Palinggoot 70 265
## 4 4 10/0~ VA_PG_R~ Palinggoot 68 266
## 5 5 10/0~ VA_PG_R~ Palinggoot 76 356
## 6 6 11/0~ VA_PG_L~ Palinggoot 66 313
## # ... with 16 more variables: pigmentation.stage <fct>,
## # condition.factor <dbl>, Food.visible <fct>, remarks <fct>, X <lgl>,
## # X.1 <fct>, X.2 <lgl>, X.3 <lgl>, X.4 <lgl>, X.5 <fct>, X.6 <lgl>,
## # X.7 <lgl>, X.8 <lgl>, X.9 <lgl>, X.10 <lgl>, X.11 <lgl>
data_inbo$Date <- strptime(as.character(data_inbo$Date), "%d/%m/%Y")
And then we can start exploring!
## List of 60
## $ line :List of 6
## ..$ colour : chr "black"
## ..$ size : num 0.5
## ..$ linetype : num 1
## ..$ lineend : chr "butt"
## ..$ arrow : logi FALSE
## ..$ inherit.blank: logi TRUE
## ..- attr(*, "class")= chr [1:2] "element_line" "element"
## $ rect :List of 5
## ..$ fill : chr "white"
## ..$ colour : chr "black"
## ..$ size : num 0.5
## ..$ linetype : num 1
## ..$ inherit.blank: logi TRUE
## ..- attr(*, "class")= chr [1:2] "element_rect" "element"
## $ text :List of 11
## ..$ family : chr ""
## ..$ face : chr "plain"
## ..$ colour : chr "black"
## ..$ size : num 11
## ..$ hjust : num 0.5
## ..$ vjust : num 0.5
## ..$ angle : num 0
## ..$ lineheight : num 0.9
## ..$ margin :Classes 'margin', 'unit' atomic [1:4] 0 0 0 0
## .. .. ..- attr(*, "valid.unit")= int 8
## .. .. ..- attr(*, "unit")= chr "pt"
## ..$ debug : logi FALSE
## ..$ inherit.blank: logi TRUE
## ..- attr(*, "class")= chr [1:2] "element_text" "element"
## $ axis.title.x :List of 11
## ..$ family : NULL
## ..$ face : NULL
## ..$ colour : NULL
## ..$ size : NULL
## ..$ hjust : NULL
## ..$ vjust : num 1
## ..$ angle : NULL
## ..$ lineheight : NULL
## ..$ margin :Classes 'margin', 'unit' atomic [1:4] 2.75 0 0 0
## .. .. ..- attr(*, "valid.unit")= int 8
## .. .. ..- attr(*, "unit")= chr "pt"
## ..$ debug : NULL
## ..$ inherit.blank: logi TRUE
## ..- attr(*, "class")= chr [1:2] "element_text" "element"
## $ axis.title.x.top :List of 11
## ..$ family : NULL
## ..$ face : NULL
## ..$ colour : NULL
## ..$ size : NULL
## ..$ hjust : NULL
## ..$ vjust : num 0
## ..$ angle : NULL
## ..$ lineheight : NULL
## ..$ margin :Classes 'margin', 'unit' atomic [1:4] 0 0 2.75 0
## .. .. ..- attr(*, "valid.unit")= int 8
## .. .. ..- attr(*, "unit")= chr "pt"
## ..$ debug : NULL
## ..$ inherit.blank: logi TRUE
## ..- attr(*, "class")= chr [1:2] "element_text" "element"
## $ axis.title.y :List of 11
## ..$ family : NULL
## ..$ face : NULL
## ..$ colour : NULL
## ..$ size : NULL
## ..$ hjust : NULL
## ..$ vjust : num 1
## ..$ angle : num 90
## ..$ lineheight : NULL
## ..$ margin :Classes 'margin', 'unit' atomic [1:4] 0 2.75 0 0
## .. .. ..- attr(*, "valid.unit")= int 8
## .. .. ..- attr(*, "unit")= chr "pt"
## ..$ debug : NULL
## ..$ inherit.blank: logi TRUE
## ..- attr(*, "class")= chr [1:2] "element_text" "element"
## $ axis.title.y.right :List of 11
## ..$ family : NULL
## ..$ face : NULL
## ..$ colour : NULL
## ..$ size : NULL
## ..$ hjust : NULL
## ..$ vjust : num 0
## ..$ angle : num -90
## ..$ lineheight : NULL
## ..$ margin :Classes 'margin', 'unit' atomic [1:4] 0 0 0 2.75
## .. .. ..- attr(*, "valid.unit")= int 8
## .. .. ..- attr(*, "unit")= chr "pt"
## ..$ debug : NULL
## ..$ inherit.blank: logi TRUE
## ..- attr(*, "class")= chr [1:2] "element_text" "element"
## $ axis.text :List of 11
## ..$ family : NULL
## ..$ face : NULL
## ..$ colour : chr "grey30"
## ..$ size :Class 'rel' num 0.8
## ..$ hjust : NULL
## ..$ vjust : NULL
## ..$ angle : NULL
## ..$ lineheight : NULL
## ..$ margin : NULL
## ..$ debug : NULL
## ..$ inherit.blank: logi TRUE
## ..- attr(*, "class")= chr [1:2] "element_text" "element"
## $ axis.text.x :List of 11
## ..$ family : NULL
## ..$ face : NULL
## ..$ colour : NULL
## ..$ size : NULL
## ..$ hjust : NULL
## ..$ vjust : num 1
## ..$ angle : NULL
## ..$ lineheight : NULL
## ..$ margin :Classes 'margin', 'unit' atomic [1:4] 2.2 0 0 0
## .. .. ..- attr(*, "valid.unit")= int 8
## .. .. ..- attr(*, "unit")= chr "pt"
## ..$ debug : NULL
## ..$ inherit.blank: logi TRUE
## ..- attr(*, "class")= chr [1:2] "element_text" "element"
## $ axis.text.x.top :List of 11
## ..$ family : NULL
## ..$ face : NULL
## ..$ colour : NULL
## ..$ size : NULL
## ..$ hjust : NULL
## ..$ vjust : num 0
## ..$ angle : NULL
## ..$ lineheight : NULL
## ..$ margin :Classes 'margin', 'unit' atomic [1:4] 0 0 2.2 0
## .. .. ..- attr(*, "valid.unit")= int 8
## .. .. ..- attr(*, "unit")= chr "pt"
## ..$ debug : NULL
## ..$ inherit.blank: logi TRUE
## ..- attr(*, "class")= chr [1:2] "element_text" "element"
## $ axis.text.y :List of 11
## ..$ family : NULL
## ..$ face : NULL
## ..$ colour : NULL
## ..$ size : NULL
## ..$ hjust : num 1
## ..$ vjust : NULL
## ..$ angle : NULL
## ..$ lineheight : NULL
## ..$ margin :Classes 'margin', 'unit' atomic [1:4] 0 2.2 0 0
## .. .. ..- attr(*, "valid.unit")= int 8
## .. .. ..- attr(*, "unit")= chr "pt"
## ..$ debug : NULL
## ..$ inherit.blank: logi TRUE
## ..- attr(*, "class")= chr [1:2] "element_text" "element"
## $ axis.text.y.right :List of 11
## ..$ family : NULL
## ..$ face : NULL
## ..$ colour : NULL
## ..$ size : NULL
## ..$ hjust : num 0
## ..$ vjust : NULL
## ..$ angle : NULL
## ..$ lineheight : NULL
## ..$ margin :Classes 'margin', 'unit' atomic [1:4] 0 0 0 2.2
## .. .. ..- attr(*, "valid.unit")= int 8
## .. .. ..- attr(*, "unit")= chr "pt"
## ..$ debug : NULL
## ..$ inherit.blank: logi TRUE
## ..- attr(*, "class")= chr [1:2] "element_text" "element"
## $ axis.ticks :List of 6
## ..$ colour : chr "grey20"
## ..$ size : NULL
## ..$ linetype : NULL
## ..$ lineend : NULL
## ..$ arrow : logi FALSE
## ..$ inherit.blank: logi TRUE
## ..- attr(*, "class")= chr [1:2] "element_line" "element"
## $ axis.ticks.length :Class 'unit' atomic [1:1] 2.75
## .. ..- attr(*, "valid.unit")= int 8
## .. ..- attr(*, "unit")= chr "pt"
## $ axis.line :List of 6
## ..$ colour : chr "black"
## ..$ size :Class 'rel' num 1
## ..$ linetype : NULL
## ..$ lineend : NULL
## ..$ arrow : logi FALSE
## ..$ inherit.blank: logi TRUE
## ..- attr(*, "class")= chr [1:2] "element_line" "element"
## $ axis.line.x : NULL
## $ axis.line.y : NULL
## $ legend.background :List of 5
## ..$ fill : NULL
## ..$ colour : logi NA
## ..$ size : NULL
## ..$ linetype : NULL
## ..$ inherit.blank: logi TRUE
## ..- attr(*, "class")= chr [1:2] "element_rect" "element"
## $ legend.margin :Classes 'margin', 'unit' atomic [1:4] 5.5 5.5 5.5 5.5
## .. ..- attr(*, "valid.unit")= int 8
## .. ..- attr(*, "unit")= chr "pt"
## $ legend.spacing :Class 'unit' atomic [1:1] 11
## .. ..- attr(*, "valid.unit")= int 8
## .. ..- attr(*, "unit")= chr "pt"
## $ legend.spacing.x : NULL
## $ legend.spacing.y : NULL
## $ legend.key : list()
## ..- attr(*, "class")= chr [1:2] "element_blank" "element"
## $ legend.key.size :Class 'unit' atomic [1:1] 1.2
## .. ..- attr(*, "valid.unit")= int 3
## .. ..- attr(*, "unit")= chr "lines"
## $ legend.key.height : NULL
## $ legend.key.width : NULL
## $ legend.text :List of 11
## ..$ family : NULL
## ..$ face : NULL
## ..$ colour : NULL
## ..$ size :Class 'rel' num 0.8
## ..$ hjust : NULL
## ..$ vjust : NULL
## ..$ angle : NULL
## ..$ lineheight : NULL
## ..$ margin : NULL
## ..$ debug : NULL
## ..$ inherit.blank: logi TRUE
## ..- attr(*, "class")= chr [1:2] "element_text" "element"
## $ legend.text.align : NULL
## $ legend.title :List of 11
## ..$ family : NULL
## ..$ face : NULL
## ..$ colour : NULL
## ..$ size : NULL
## ..$ hjust : num 0
## ..$ vjust : NULL
## ..$ angle : NULL
## ..$ lineheight : NULL
## ..$ margin : NULL
## ..$ debug : NULL
## ..$ inherit.blank: logi TRUE
## ..- attr(*, "class")= chr [1:2] "element_text" "element"
## $ legend.title.align : NULL
## $ legend.position : chr "right"
## $ legend.direction : NULL
## $ legend.justification : chr "center"
## $ legend.box : NULL
## $ legend.box.margin :Classes 'margin', 'unit' atomic [1:4] 0 0 0 0
## .. ..- attr(*, "valid.unit")= int 1
## .. ..- attr(*, "unit")= chr "cm"
## $ legend.box.background: list()
## ..- attr(*, "class")= chr [1:2] "element_blank" "element"
## $ legend.box.spacing :Class 'unit' atomic [1:1] 11
## .. ..- attr(*, "valid.unit")= int 8
## .. ..- attr(*, "unit")= chr "pt"
## $ panel.background :List of 5
## ..$ fill : chr "white"
## ..$ colour : logi NA
## ..$ size : NULL
## ..$ linetype : NULL
## ..$ inherit.blank: logi TRUE
## ..- attr(*, "class")= chr [1:2] "element_rect" "element"
## $ panel.border : list()
## ..- attr(*, "class")= chr [1:2] "element_blank" "element"
## $ panel.spacing :Class 'unit' atomic [1:1] 5.5
## .. ..- attr(*, "valid.unit")= int 8
## .. ..- attr(*, "unit")= chr "pt"
## $ panel.spacing.x : NULL
## $ panel.spacing.y : NULL
## $ panel.grid :List of 6
## ..$ colour : chr "grey92"
## ..$ size : NULL
## ..$ linetype : NULL
## ..$ lineend : NULL
## ..$ arrow : logi FALSE
## ..$ inherit.blank: logi TRUE
## ..- attr(*, "class")= chr [1:2] "element_line" "element"
## $ panel.grid.minor : list()
## ..- attr(*, "class")= chr [1:2] "element_blank" "element"
## $ panel.ontop : logi FALSE
## $ plot.background :List of 5
## ..$ fill : NULL
## ..$ colour : chr "white"
## ..$ size : NULL
## ..$ linetype : NULL
## ..$ inherit.blank: logi TRUE
## ..- attr(*, "class")= chr [1:2] "element_rect" "element"
## $ plot.title :List of 11
## ..$ family : NULL
## ..$ face : NULL
## ..$ colour : NULL
## ..$ size :Class 'rel' num 1.2
## ..$ hjust : num 0
## ..$ vjust : num 1
## ..$ angle : NULL
## ..$ lineheight : NULL
## ..$ margin :Classes 'margin', 'unit' atomic [1:4] 0 0 5.5 0
## .. .. ..- attr(*, "valid.unit")= int 8
## .. .. ..- attr(*, "unit")= chr "pt"
## ..$ debug : NULL
## ..$ inherit.blank: logi TRUE
## ..- attr(*, "class")= chr [1:2] "element_text" "element"
## $ plot.subtitle :List of 11
## ..$ family : NULL
## ..$ face : NULL
## ..$ colour : NULL
## ..$ size : NULL
## ..$ hjust : num 0
## ..$ vjust : num 1
## ..$ angle : NULL
## ..$ lineheight : NULL
## ..$ margin :Classes 'margin', 'unit' atomic [1:4] 0 0 5.5 0
## .. .. ..- attr(*, "valid.unit")= int 8
## .. .. ..- attr(*, "unit")= chr "pt"
## ..$ debug : NULL
## ..$ inherit.blank: logi TRUE
## ..- attr(*, "class")= chr [1:2] "element_text" "element"
## $ plot.caption :List of 11
## ..$ family : NULL
## ..$ face : NULL
## ..$ colour : NULL
## ..$ size :Class 'rel' num 0.8
## ..$ hjust : num 1
## ..$ vjust : num 1
## ..$ angle : NULL
## ..$ lineheight : NULL
## ..$ margin :Classes 'margin', 'unit' atomic [1:4] 5.5 0 0 0
## .. .. ..- attr(*, "valid.unit")= int 8
## .. .. ..- attr(*, "unit")= chr "pt"
## ..$ debug : NULL
## ..$ inherit.blank: logi TRUE
## ..- attr(*, "class")= chr [1:2] "element_text" "element"
## $ plot.tag :List of 11
## ..$ family : NULL
## ..$ face : NULL
## ..$ colour : NULL
## ..$ size :Class 'rel' num 1.2
## ..$ hjust : num 0.5
## ..$ vjust : num 0.5
## ..$ angle : NULL
## ..$ lineheight : NULL
## ..$ margin : NULL
## ..$ debug : NULL
## ..$ inherit.blank: logi TRUE
## ..- attr(*, "class")= chr [1:2] "element_text" "element"
## $ plot.tag.position : chr "topleft"
## $ plot.margin :Classes 'margin', 'unit' atomic [1:4] 5.5 5.5 5.5 5.5
## .. ..- attr(*, "valid.unit")= int 8
## .. ..- attr(*, "unit")= chr "pt"
## $ strip.background :List of 5
## ..$ fill : chr "white"
## ..$ colour : chr "black"
## ..$ size :Class 'rel' num 2
## ..$ linetype : NULL
## ..$ inherit.blank: logi TRUE
## ..- attr(*, "class")= chr [1:2] "element_rect" "element"
## $ strip.placement : chr "inside"
## $ strip.text :List of 11
## ..$ family : NULL
## ..$ face : NULL
## ..$ colour : chr "grey10"
## ..$ size :Class 'rel' num 0.8
## ..$ hjust : NULL
## ..$ vjust : NULL
## ..$ angle : NULL
## ..$ lineheight : NULL
## ..$ margin :Classes 'margin', 'unit' atomic [1:4] 4.4 4.4 4.4 4.4
## .. .. ..- attr(*, "valid.unit")= int 8
## .. .. ..- attr(*, "unit")= chr "pt"
## ..$ debug : NULL
## ..$ inherit.blank: logi TRUE
## ..- attr(*, "class")= chr [1:2] "element_text" "element"
## $ strip.text.x : NULL
## $ strip.text.y :List of 11
## ..$ family : NULL
## ..$ face : NULL
## ..$ colour : NULL
## ..$ size : NULL
## ..$ hjust : NULL
## ..$ vjust : NULL
## ..$ angle : num -90
## ..$ lineheight : NULL
## ..$ margin : NULL
## ..$ debug : NULL
## ..$ inherit.blank: logi TRUE
## ..- attr(*, "class")= chr [1:2] "element_text" "element"
## $ strip.switch.pad.grid:Class 'unit' atomic [1:1] 2.75
## .. ..- attr(*, "valid.unit")= int 8
## .. ..- attr(*, "unit")= chr "pt"
## $ strip.switch.pad.wrap:Class 'unit' atomic [1:1] 2.75
## .. ..- attr(*, "valid.unit")= int 8
## .. ..- attr(*, "unit")= chr "pt"
## $ panel.grid.major : list()
## ..- attr(*, "class")= chr [1:2] "element_blank" "element"
## - attr(*, "class")= chr [1:2] "theme" "gg"
## - attr(*, "complete")= logi TRUE
## - attr(*, "validate")= logi TRUE
TO DO: map met locaties aangeduid op satellietafbeelding
VA_PG_LO_PA: Veurne Ambacht canal pumping station left bank eel ladder VA_PG_RO_PA: Veurne Ambacht canal pumping station right bank eel ladder VA_PG_LO_SU: Veurne Ambacht canal pumping station left bank substrates VA_PG_RO_SU: Veurne Ambacht canal pumping station right bank substrates VA_MI_LO_SU: Veurne Ambacht canal middle left bank substrates VA_MI_RO_SU: Veurne Ambacht canal middle right bank substrates VA_SC_LO_SU: Veurne Ambacht canal sluicecomplex Ganzepoot left bank substrates VA_SC_RO_SU: Veurne Ambacht canal sluicecomplex Ganzepoot right bank substrates VA_PG_KR_NA: Veurne Ambacht canal pumpingstation liftnets night GA_SU: Ganzepoot substrates
colnames <- c("Microplastics.Contaminatie.vezels..katoen..", "Cladocera.sp.", "Annelida", "Polychaete", "Isopoda", "Diptera.sp.", "Chironomida.sp.", "Crustaceae.sp.", "Cycloida.sp.", "Unidentified.sp.", 'Amphipoda.sp.', 'Calanoida.sp.', "Copepoda.sp.", "Harpacticoid.Copepod", "Hexapode.sp....", "keverlarve", "Pennate.diatomee","Plantae.sp.")
for (i in 1:length(colnames)) {
bp <- ggplot(maaginhoud2, aes_string(x="''", y = colnames[i], fill = "Methode")) +
geom_bar(width = 1, stat="identity")
pie <- bp + coord_polar("y", start= 0)
print(pie)
}
## Warning: Removed 36 rows containing missing values (position_stack).
## Warning: Removed 36 rows containing missing values (position_stack).
## Warning: Removed 36 rows containing missing values (position_stack).
## Warning: Removed 36 rows containing missing values (position_stack).
## Warning: Removed 36 rows containing missing values (position_stack).
## Warning: Removed 36 rows containing missing values (position_stack).
## Warning: Removed 36 rows containing missing values (position_stack).
## Warning: Removed 36 rows containing missing values (position_stack).
## Warning: Removed 36 rows containing missing values (position_stack).
## Warning: Removed 36 rows containing missing values (position_stack).
## Warning: Removed 36 rows containing missing values (position_stack).
## Warning: Removed 36 rows containing missing values (position_stack).
## Warning: Removed 36 rows containing missing values (position_stack).
## Warning: Removed 36 rows containing missing values (position_stack).
## Warning: Removed 36 rows containing missing values (position_stack).
## Warning: Removed 36 rows containing missing values (position_stack).
## Warning: Removed 36 rows containing missing values (position_stack).
## Warning: Removed 36 rows containing missing values (position_stack).
for (i in 1:length(colnames)) {
bp <- ggplot(maaginhoud2, aes_string(x="''", y = colnames[i], fill = "Locatie_A")) +
geom_bar(width = 1, stat="identity")
pie <- bp + coord_polar("y", start= 0)
print(pie)
}
## Warning: Removed 36 rows containing missing values (position_stack).
## Warning: Removed 36 rows containing missing values (position_stack).
## Warning: Removed 36 rows containing missing values (position_stack).
## Warning: Removed 36 rows containing missing values (position_stack).
## Warning: Removed 36 rows containing missing values (position_stack).
## Warning: Removed 36 rows containing missing values (position_stack).
## Warning: Removed 36 rows containing missing values (position_stack).
## Warning: Removed 36 rows containing missing values (position_stack).
## Warning: Removed 36 rows containing missing values (position_stack).
## Warning: Removed 36 rows containing missing values (position_stack).
## Warning: Removed 36 rows containing missing values (position_stack).
## Warning: Removed 36 rows containing missing values (position_stack).
## Warning: Removed 36 rows containing missing values (position_stack).
## Warning: Removed 36 rows containing missing values (position_stack).
## Warning: Removed 36 rows containing missing values (position_stack).
## Warning: Removed 36 rows containing missing values (position_stack).
## Warning: Removed 36 rows containing missing values (position_stack).
## Warning: Removed 36 rows containing missing values (position_stack).
But now, we want to constructs piecharts which are not absolute numbers, but relative numbers. For example, if a glass eel ate 1 polychaete out of the total of 50 found polychaetes, this results in a relative number on the pie chart of 2%
maaginhoud2 <- remove_empty(maaginhoud2, 'rows')
col_sum <- colSums(maaginhoud2[7:24], na.rm = TRUE)
maaginhoud3 <- maaginhoud2[1:6]
new_column <- list()
for (count in 7:length(maaginhoud2)) {
new_column <- (maaginhoud2[count] / col_sum[count - 6])
maaginhoud3 <- cbind(maaginhoud3, new_column)
}
for (i in 1:length(colnames)) {
bp <- ggplot(maaginhoud3, aes_string(x="''", y = colnames[i], fill = "Methode")) +
geom_bar(width = 1, stat="identity")
pie <- bp + coord_polar("y", start= 0)
print(pie)
}
## Warning: Removed 36 rows containing missing values (position_stack).
## Warning: Removed 36 rows containing missing values (position_stack).
## Warning: Removed 36 rows containing missing values (position_stack).
## Warning: Removed 36 rows containing missing values (position_stack).
## Warning: Removed 36 rows containing missing values (position_stack).
## Warning: Removed 36 rows containing missing values (position_stack).
## Warning: Removed 36 rows containing missing values (position_stack).
## Warning: Removed 36 rows containing missing values (position_stack).
## Warning: Removed 36 rows containing missing values (position_stack).
## Warning: Removed 36 rows containing missing values (position_stack).
## Warning: Removed 36 rows containing missing values (position_stack).
## Warning: Removed 36 rows containing missing values (position_stack).
## Warning: Removed 36 rows containing missing values (position_stack).
## Warning: Removed 36 rows containing missing values (position_stack).
## Warning: Removed 36 rows containing missing values (position_stack).
## Warning: Removed 36 rows containing missing values (position_stack).
## Warning: Removed 36 rows containing missing values (position_stack).
## Warning: Removed 36 rows containing missing values (position_stack).
for (i in 1:length(colnames)) {
bp <- ggplot(maaginhoud3, aes_string(x="''", y = colnames[i], fill = "Locatie_A")) +
geom_bar(width = 1, stat="identity")
pie <- bp + coord_polar("y", start= 0)
print(pie)
}
## Warning: Removed 36 rows containing missing values (position_stack).
## Warning: Removed 36 rows containing missing values (position_stack).
## Warning: Removed 36 rows containing missing values (position_stack).
## Warning: Removed 36 rows containing missing values (position_stack).
## Warning: Removed 36 rows containing missing values (position_stack).
## Warning: Removed 36 rows containing missing values (position_stack).
## Warning: Removed 36 rows containing missing values (position_stack).
## Warning: Removed 36 rows containing missing values (position_stack).
## Warning: Removed 36 rows containing missing values (position_stack).
## Warning: Removed 36 rows containing missing values (position_stack).
## Warning: Removed 36 rows containing missing values (position_stack).
## Warning: Removed 36 rows containing missing values (position_stack).
## Warning: Removed 36 rows containing missing values (position_stack).
## Warning: Removed 36 rows containing missing values (position_stack).
## Warning: Removed 36 rows containing missing values (position_stack).
## Warning: Removed 36 rows containing missing values (position_stack).
## Warning: Removed 36 rows containing missing values (position_stack).
## Warning: Removed 36 rows containing missing values (position_stack).
Now we want to compose relative piecharts divided according to pigmentation stage
data_inbo_pigmentation <- data_inbo[,c("nr","pigmentation.stage")]
maaginhoud4 <- left_join(maaginhoud2, data_inbo_pigmentation, by='nr')
for (i in 1:length(colnames)) {
bp <- ggplot(maaginhoud4, aes_string(x="''", y = colnames[i], fill = "pigmentation.stage")) +
geom_bar(width = 1, stat="identity")
pie <- bp + coord_polar("y", start= 0)
print(pie)
}
## Warning: Removed 36 rows containing missing values (position_stack).
## Warning: Removed 36 rows containing missing values (position_stack).
## Warning: Removed 36 rows containing missing values (position_stack).
## Warning: Removed 36 rows containing missing values (position_stack).
## Warning: Removed 36 rows containing missing values (position_stack).
## Warning: Removed 36 rows containing missing values (position_stack).
## Warning: Removed 36 rows containing missing values (position_stack).
## Warning: Removed 36 rows containing missing values (position_stack).
## Warning: Removed 36 rows containing missing values (position_stack).
## Warning: Removed 36 rows containing missing values (position_stack).
## Warning: Removed 36 rows containing missing values (position_stack).
## Warning: Removed 36 rows containing missing values (position_stack).
## Warning: Removed 36 rows containing missing values (position_stack).
## Warning: Removed 36 rows containing missing values (position_stack).
## Warning: Removed 36 rows containing missing values (position_stack).
## Warning: Removed 36 rows containing missing values (position_stack).
## Warning: Removed 36 rows containing missing values (position_stack).
## Warning: Removed 36 rows containing missing values (position_stack).
Now we want to compare what the relative percentage caught per method & location is To do so, we need a transposed data table. This needs some more work
Hier wordt weergegeven welke organismen op welke tijd van het jaar in verschillende pigmentatiestadia van de glasaal teruggevonden werden.
for (i in 1:length(colnames)) {
bp <- ggplot(maaginhoud4, aes_string(x=week(as.Date(maaginhoud4$datum)), y = colnames[i], fill = "pigmentation.stage")) +
geom_bar(width = 1, stat="identity") +
xlab(label = "Week of 2017")
print(bp)
}
## Warning: Removed 36 rows containing missing values (position_stack).
## Warning: Removed 36 rows containing missing values (position_stack).
## Warning: Removed 36 rows containing missing values (position_stack).
## Warning: Removed 36 rows containing missing values (position_stack).
## Warning: Removed 36 rows containing missing values (position_stack).
## Warning: Removed 36 rows containing missing values (position_stack).
## Warning: Removed 36 rows containing missing values (position_stack).
## Warning: Removed 36 rows containing missing values (position_stack).
## Warning: Removed 36 rows containing missing values (position_stack).
## Warning: Removed 36 rows containing missing values (position_stack).
## Warning: Removed 36 rows containing missing values (position_stack).
## Warning: Removed 36 rows containing missing values (position_stack).
## Warning: Removed 36 rows containing missing values (position_stack).
## Warning: Removed 36 rows containing missing values (position_stack).
## Warning: Removed 36 rows containing missing values (position_stack).
## Warning: Removed 36 rows containing missing values (position_stack).
## Warning: Removed 36 rows containing missing values (position_stack).
## Warning: Removed 36 rows containing missing values (position_stack).
Een ideetje om de Forage ratio te berekenen. Forage ratio:
\[ \frac{percent~weight~of~food~item~i~in~stomach~of~glass~eel~w}{percent~weight~of~food~item~i~in~the~environment}~~~~ x ~~ 100 \] Hier bekijken we eens de dataset waarin het aantal individuen per liter werd bekeken in 2016, maar om de bovenstaande ratio te berekenen zou toch een set van het jaar 2017 nodig zijn. Is die er?
environment2016_ind <- as.tibble(read.csv("C:/Users/user/Desktop/Biologie/Master/Thesis/Thesis/data/raw/Individuals per liter 2016.csv", sep = ";", header = TRUE, dec = ","))
env_cyclo <- ggplot(environment2016_ind, aes(week(as.Date(Datum)), Cyclopoida)) +
geom_point() +
ylab("Cyclopoida ind/L 2016")
env_cyclo
env_alona_a <- ggplot(environment2016_ind, aes(week(Datum), Alona.affinis)) +
geom_point() +
ylab("Alona affinis ind/L 2016")
env_alona_a
env_alona_r <- ggplot(environment2016_ind, aes(week(Datum), Alona.rectangula)) +
geom_point() +
ylab("Alona rectangula ind/L 2016")
env_alona_r
env_chydorus <- ggplot(environment2016_ind, aes(week(Datum), Chydorus.sphaericus)) +
geom_point() +
ylab("Chydorus sphaericus ind/L 2016")
env_chydorus
env_daphnia <- ggplot(environment2016_ind, aes(week(Datum), Daphnia.galeata)) +
geom_point() +
ylab("Daphnia galeata ind/L 2016")
env_daphnia
env_pleuroxus <- ggplot(environment2016_ind, aes(week(Datum), Pleuroxus.aduncus)) +
geom_point() +
ylab("Pleuroxus aduncus ind/L 2016")
env_pleuroxus
Here, we calculate some indices from the dataset and visually explore these.
First, the condition factor is analysed. Condition factor is already a variable in the dataset, calculated by the INBO.
Vraag voor jeroen: hoe werd deze conditiefactor juist berekend?
plot_condfact_method <- ggplot(data_inbo, aes(week(Date), condition.factor)) +
geom_point() +
ggtitle("Condition factor of glass eel vs week of catchment") +
facet_grid(.~Catchment.method) +
xlab("Conditiefactor") +
ylab("Week van het jaar 2017")
plot_condfact_method
plot_condfact_location <- ggplot(data_inbo, aes(week(Date), condition.factor)) +
geom_point() +
ggtitle("Condition factor of glass eel vs week of catchment") +
facet_grid(.~Location)
plot_condfact_location
plot_condfact_pigm <- ggplot(data_inbo, aes(pigmentation.stage, condition.factor)) +
geom_point() +
ggtitle("Condition factor of glass eel vs week of catchment")
plot_condfact_pigm
# Nu de conditiefactor duidelijker weergeven, maar nu enkel voor de al verwerkte glasalen
nr_locatie_methode <- select(maaginhoud2, nr, Locatie_A, Locatie_Oever, Methode)
nr_pigmentation_condfact <- select(data_inbo, nr, pigmentation.stage, condition.factor)
maaginhoud6 <- select(maaginhoud, nr, datum, Gewicht.Glasaal, Gewicht.maag.darmstelsel)
maaginhoud6 <- mutate(maaginhoud6, ratio_visceral_total = Gewicht.maag.darmstelsel / Gewicht.Glasaal)
maaginhoud6_wo_outlier <- filter(maaginhoud6, ratio_visceral_total < 1) # reden: zie hieronder
maaginhoud6_wo_outlier$datum <- strptime(as.character(maaginhoud6_wo_outlier$datum), "%d/%m/%Y")
maaginhoud7 <- left_join(maaginhoud6_wo_outlier, nr_locatie_methode, by='nr')
maaginhoud7 <- left_join(maaginhoud7, nr_pigmentation_condfact, by='nr')
plot_condfact_location_2 <- ggplot(maaginhoud7, aes(week(as.Date(datum)), condition.factor)) +
geom_point() +
ggtitle("Condition factor vs week of catchment") +
facet_grid(.~Locatie_A) +
xlab("Week van het jaar 2017") +
ylab("Conditiefactor")
plot_condfact_location_2
## Warning: Removed 3 rows containing missing values (geom_point).
plot_condfact_method_2 <- ggplot(maaginhoud7, aes(week(as.Date(datum)), condition.factor)) +
geom_point() +
ggtitle("Condition factor vs week of catchment") +
facet_grid(.~Methode) +
xlab("Week van het jaar 2017") +
ylab("Conditiefactor")
plot_condfact_method_2
## Warning: Removed 3 rows containing missing values (geom_point).
### Number method
\[ \frac{amount~of~food~~item~i}{total~number~of~items~found~in~gut}~~~~ x ~~ 100 \] Vertelt dit niet wat hetzelfde als de piecharts? Onderstaande code werkt ook nog niet helemaal…
maaginhoud_index1 <- maaginhoud2[1:6]
maaginhoud_temp <- maaginhoud2[7:24]
for (rw in 1:length(maaginhoud_temp)) {
tmp <- maaginhoud_temp[rw,]/sum(maaginhoud_temp[rw,])
if (tmp) {
maaginhoud_index1 <- rbind(maaginhoud_index1, tmp);
} else {
maaginhoud_index1 <- rbind(maaginhoud_index1, maaginhoud_temp[rw,])
}
}
Second, we calculate the ratio of visceral organs on total body mass.Dit is een index voor de ‘fulness’ van de glasaal.
\[ \frac{weight~of~stomach-gut~system~of~glass~eel~w}{total~body~mass~of~glass~eel~w}~~~~ x ~~ 100 \]
plot_ratio_method <- ggplot(maaginhoud6, aes(week(as.Date(datum)), ratio_visceral_total)) +
geom_point() +
ggtitle("Ratio of visceral organs on total body mass of glass eel vs week of catchment") +
ylab("Ratio viscerale organen / Totale lichaamsgewicht glasaal") +
xlab("Week van 2017")
plot_ratio_method # Dikke outlier wegwerken
## Warning: Removed 77 rows containing missing values (geom_point).
plot_ratio_method <- ggplot(maaginhoud6_wo_outlier, aes(week(as.Date(datum)), ratio_visceral_total)) +
geom_point() +
ggtitle("Ratio of visceral organs on total body mass of glass eel vs week of catchment") +
ylab("Ratio viscerale organen / Totale lichaamsgewicht glasaal") +
xlab("Week van 2017")
plot_ratio_method
## Warning: Removed 2 rows containing missing values (geom_point).
According to previous plot, glass eel do tend to be more fed at the end of spring. This is true for all catchment methods & locations. But is this really the case?
plot_ratio_location <- ggplot(maaginhoud7, aes(week(as.Date(datum)), ratio_visceral_total)) +
geom_point() +
ggtitle("Ratio of visceral organs on total body mass of glass eel vs week of catchment") +
facet_grid(.~Locatie_A) +
ylab("Ratio viscerale organen / Totale lichaamsgewicht glasaal") +
xlab("Week van 2017")
plot_ratio_location
## Warning: Removed 2 rows containing missing values (geom_point).
plot_ratio_method <- ggplot(maaginhoud7, aes(week(as.Date(datum)), ratio_visceral_total)) +
geom_point() +
ggtitle("Ratio of visceral organs on total body mass of glass eel vs week of catchment") +
facet_grid(.~Methode) +
ylab("Ratio viscerale organen / Totale lichaamsgewicht glasaal") +
xlab("Week van 2017")
plot_ratio_method
## Warning: Removed 2 rows containing missing values (geom_point).
plot_ratio_location2 <- ggplot(maaginhoud7, aes(week(as.Date(datum)), ratio_visceral_total)) +
geom_point() +
ggtitle("Ratio of visceral organs on total body mass of glass eel vs week of catchment") +
facet_grid(.~Locatie_Oever) +
ylab("Ratio viscerale organen / Totale lichaamsgewicht glasaal") +
xlab("Week van 2017")
plot_ratio_location2
## Warning: Removed 2 rows containing missing values (geom_point).
plot_ratio_pigm_methode <- ggplot(maaginhoud7, aes(pigmentation.stage, ratio_visceral_total, fill = Methode)) +
geom_boxplot() +
ggtitle("Ratio of visceral organs on total body mass of glass eel vs pigmentation stage") +
ylab("Ratio viscerale organen / Totale lichaamsgewicht glasaal") +
xlab("Pigmentatiestadium") +
scale_fill_manual(values=wes_palette(n=3, name="Moonrise2"))
plot_ratio_pigm_methode
plot_ratio_pigm_locatie <- ggplot(maaginhoud7, aes(pigmentation.stage, ratio_visceral_total, fill = Locatie_A)) +
geom_boxplot() +
ggtitle("Ratio of visceral organs on total body mass of glass eel vs pigmentation stage") +
scale_fill_manual(values=wes_palette(n=4, name="Moonrise2")) +
ylab("Ratio viscerale organen / Totale lichaamsgewicht glasaal") +
xlab("Pigmentatiestadium")
plot_ratio_pigm_locatie
plot_ratio_pigm_methode <- ggplot(maaginhoud7, aes(pigmentation.stage, ratio_visceral_total, fill = Methode)) +
geom_boxplot() +
scale_fill_manual(values=wes_palette(n=3, name="Moonrise2")) +
ggtitle("Ratio of visceral organs on total body mass of glass eel vs pigmentation stage") +
facet_grid(.~Locatie_A) +
ylab("Ratio viscerale organen / Totale lichaamsgewicht glasaal") +
xlab("Pigmentatiestadium")
plot_ratio_pigm_methode
plot_ratio_tijd_methode <- ggplot(maaginhoud7, aes(week(datum), ratio_visceral_total, fill = Methode)) +
geom_boxplot() +
ggtitle("Ratio of visceral organs on total body mass of glass eel vs time") +
scale_fill_manual(values=wes_palette(n=4, name="Moonrise2")) +
facet_grid(.~Locatie_A) +
ylab("Ratio viscerale organen / Totale lichaamsgewicht glasaal") +
xlab("Week van 2017")
#facet_zoom( x = Locatie_A == "Pompgemaal")
plot_ratio_tijd_methode
## Warning: Removed 2 rows containing missing values (stat_boxplot).
And indeed, it is the case across methods and locations.However, data from the pompgemaal is probably most reliable, since not all pigmentation stages were caught at other locations, and only substrates were used to catch glass eels.
As in Charlottes’ bachelorproef, we could calculate several diversity indices. However, these are clasiccally used in ecological community turnover studies. Are these really applicable?
library(vegan)
## Warning: package 'vegan' was built under R version 3.4.4
## Loading required package: permute
## Warning: package 'permute' was built under R version 3.4.4
## Loading required package: lattice
## Warning: package 'lattice' was built under R version 3.4.4
## This is vegan 2.5-4
maaginhoud_index2 <- select(maaginhoud2, nr, Microplastics.Contaminatie.vezels..katoen..:Plantae.sp.)
maaginhoud_index2 <- remove_empty(maaginhoud_index2, 'rows')
maaginhoud7 <- mutate(maaginhoud7, Shannon = diversity(maaginhoud_index2, index="shannon", MARGIN=1, base=exp(1)))
maaginhoud7 <- mutate(maaginhoud7, Simpson = diversity(maaginhoud_index2, index="simpson", MARGIN=1, base=exp(1)))
plot_Shannon_tijd_methode <- ggplot(maaginhoud7, aes(week(datum), Shannon, color = Methode)) +
geom_point() +
ggtitle("Shannon-Index vs time") +
scale_fill_manual(values=wes_palette(n=4, name="Moonrise2")) +
facet_grid(.~Locatie_A) +
ylab("Shannon-Index") +
xlab("Week van 2017")
#facet_zoom( x = Locatie_A == "Pompgemaal")
plot_Shannon_tijd_methode
## Warning: Removed 2 rows containing missing values (geom_point).
plot_Shannon_pigm_methode <- ggplot(maaginhoud7, aes(pigmentation.stage, Shannon, color = Methode)) +
geom_point() +
ggtitle("Shannon-Index vs pigmentation stage") +
scale_fill_manual(values=wes_palette(n=4, name="Moonrise2")) +
facet_grid(.~Locatie_A) +
ylab("Shannon-Index") +
xlab("Pigmentation Stage")
#facet_zoom( x = Locatie_A == "Pompgemaal")
plot_Shannon_pigm_methode
plot_Simpson_tijd_methode <- ggplot(maaginhoud7, aes(week(datum), Simpson, color = Methode)) +
geom_point() +
ggtitle("Simpson-Index vs time") +
scale_fill_manual(values=wes_palette(n=4, name="Moonrise2")) +
facet_grid(.~Locatie_A) +
ylab("Simpson-Index") +
xlab("Week van 2017")
#facet_zoom( x = Locatie_A == "Pompgemaal")
plot_Simpson_tijd_methode
## Warning: Removed 2 rows containing missing values (geom_point).
plot_Simpson_pigm_methode <- ggplot(maaginhoud7, aes(pigmentation.stage, Simpson, color = Methode)) +
geom_point() +
ggtitle("SImpson-Index vs pigmentation stage") +
scale_fill_manual(values=wes_palette(n=4, name="Moonrise2")) +
facet_grid(.~Locatie_A) +
ylab("Simpson-Index") +
xlab("Pigmentation Stage")
#facet_zoom( x = Locatie_A == "Pompgemaal")
plot_Simpson_pigm_methode
http://spatialecology.weebly.com/r-code--data/category/plotting
maaginhoud8 <- select(maaginhoud2, Microplastics.Contaminatie.vezels..katoen..:Plantae.sp.)
accurve<-specaccum(maaginhoud8, method="random", permutations=100)
#plot(accurve$sites, accurve$richness, xlab="Number of glass eel analysed", ylab="Species Richness")
PCA as exploration of the stomach analysis data
https://www.datacamp.com/community/tutorials/pca-analysis-r
maaginhoud2.pca <- prcomp(na.omit(maaginhoud2[7:24]), center = TRUE, scale. = TRUE)
str(maaginhoud2.pca)
ggbiplot(maaginhoud2.pca)